package com.ruoyi.scheme.service.decision.Impl;

import com.ruoyi.scheme.dto.ErsPatchAttributesDto;
import com.ruoyi.scheme.pojo.PlatFormAndSlopeEntity;
import com.ruoyi.scheme.service.decision.DataParserService;
import org.springframework.stereotype.Service;

@Service
public class DataParserServiceImpl implements DataParserService {
    @Override
    public PlatFormAndSlopeEntity parsePatchAttributes(ErsPatchAttributesDto patchAttributesDto) {
        return PlatFormAndSlopeEntity.builder()
                .fid(Long.valueOf(patchAttributesDto.getFid()))
                .spatialCoverage(patchAttributesDto.getSpatialCoverage())
                .location(Short.valueOf(String.valueOf(patchAttributesDto.getLocation())))
                .landUseType(Short.valueOf(String.valueOf(patchAttributesDto.getLandUseType())))
                .area(patchAttributesDto.getArea())
                .slope(patchAttributesDto.getSlope())
                .erosionGullyDensity(patchAttributesDto.getErosionGullyDensity())
                .ndvi(patchAttributesDto.getNdvi())
                .rndvi(patchAttributesDto.getRndvi())
                .som(patchAttributesDto.getSom())
                .tn(patchAttributesDto.getTn())
                .ak(patchAttributesDto.getAk())
                .degradationLevel(Short.valueOf(String.valueOf(patchAttributesDto.getDegradationLevel())))
                .chlorophyll(patchAttributesDto.getChlorophyll())
                .rChlorophyll(patchAttributesDto.getRChlorophyll())
                .build();
    }
}
